<?php


/**
 * Page class.
**/
class JWidget extends MrMongoDocument {
	
	const IS_PUBLIC = 0;
	const IS_FRIEND = 1;
	const IS_PRIVATE = 2;
	
	public $uid; 
	public $attribute = array();
	public $styles = array();
	public $publish = self::IS_PUBLIC;
	
	/**
	 * template varible
	 * @var unknown_type
	 */
	public $isEdit;

	/**
	* This method have to be defined in every Model
	* @return string MongoDB collection name, witch will be used to store documents of this model
	*/
	public function getCollectionName() {
		return 'jwidgets';
	}

	/**
	 * This method have to be defined in every model, like with normal CActiveRecord
	 */
	public static function model($className = __CLASS__) {
		return parent :: model($className);
	}

	public static function findByUid($uid) {
		return  self :: model()->findByAttributes(array ('uid' => $uid));
	}

}